<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>类与对象</title>
</head>
<body>
<script>
    function Person(name, age){
        this.name = name;
        this.age = age;
        this.study = function () {
            document.write(this.name + "在学习" + "<br>");
        }
    }
    const person1 = new Person("张三", 30);
    document.write(person1.name+","+person1.age);
    person1.study();

    let person2 = {"name":"Half Q", "fruit":"苹果", eat:function (){
        document.write(this.name + "吃" + this.fruit);
        }}
    person2.eat();
</script>

</body>
</html>